//
//  Analyst.m
//  RedManStock
//
//  Created by lanou3g on 15/7/21.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "Analyst.h"

@implementation Analyst

#pragma mark - 懒加载 -
- (NSString *)recomendText{
    if (_recomendText==nil) {
        _recomendText=[NSString stringWithFormat:@"推荐"];
    }
    return _recomendText;
}

- (NSString *)weekUpText{
    if (_weekUpText==nil) {
        _weekUpText=[NSString stringWithFormat:@"荐股周均涨幅"];
    }
    return _weekUpText;
}

- (AnalystViewPoints *)viewPoint{
    
    if (_viewPointSB==nil) {
        _viewPointSB=[[AnalystViewPoints alloc]init];
    }
    return _viewPointSB;
    
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"id"]) {
        self.analyst_id=[NSString stringWithFormat:@"%@",value];
    }
    if ([key isEqualToString:@"total"]) {
        self.totalSB=[NSString stringWithFormat:@"%@",value];
    }
    if ([key isEqualToString:@"recommend"]) {
        self.recommendSB=[NSString stringWithFormat:@"%@",value];
    }
    if ([key isEqualToString:@"avgWeekYieldRate"]) {
        CGFloat number=[(NSNumber *)value floatValue]*100;
        self.avgWeekYieldRateSB=[NSString stringWithFormat:@"%.2f%%",number];
    }
    if ([key isEqualToString:@"ranking"]) {
        
        int number=[value intValue];
        if (number<0) {
            self.rankingSB=[NSString stringWithFormat:@"300+"];
        }
        else{
            self.rankingSB=[NSString stringWithFormat:@"%@",value];
        }
    }
    if ([key isEqualToString:@"fans"]) {
        self.fansSB=[NSString stringWithFormat:@"%@",value];
    }
}

@end
